package service

import (
	"context"
	"video-srv/basic/config"
	__ "video-srv/basic/proto/rpc"
	"video-srv/handler/model"
)

func (s *VideoServer) GetEpisodeList(_ context.Context, in *__.GetEpisodeListReq) (*__.GetEpisodeListResp, error) {
	var episode model.Episode
	list, err := episode.GetEpisodeList(config.DB, int(in.VideoId))
	if err != nil {
		return nil, err
	}
	var video model.Video
	info, err := video.GetVideoListById(config.DB, int(in.VideoId))
	if err != nil {
		return nil, err
	}
	return &__.GetEpisodeListResp{
		List:        info,
		EpisodeList: list,
	}, nil
}
